import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        name: 'Home',
        redirect: '/home', // 重定向:重新指向其它path,会改变网址
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        redirect: '/home/homePage',
        children: [{
            path: 'homePage',
            name: 'HomePage',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/HomePage.vue')
        }, {
            path: 'live',
            name: 'Live',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Live.vue')
        }, {
            path: 'cash',
            name: 'Cash',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Cash.vue')
        }, {
            path: 'chat',
            name: 'Chat',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Chat.vue')
        }, {
            path: 'personal',
            name: 'Personal',
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/Home/Personal.vue')
        }]
    },
    {
        path: '/goods',
        name: 'Goods',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Goods.vue')
    }, {
        path: '/goodDetial',
        name: 'GoodsDetial',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/GoodsDetail.vue')
    }, {
        path: '/search',
        name: 'Search',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Search.vue')
    }, {
        path: '/address',
        name: 'Address',
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/Address.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router